package com.zkq.graduate.service.impl;

import com.zkq.graduate.mapper.MajorMapper;
import com.zkq.graduate.pojo.Major;
import com.zkq.graduate.service.MajorService;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Optional;

/**
 * @Author zhangkaiqiang
 * @Date 2019/11/26  10:13
 * @Description TODOgit
 */
@Service(value = "majorService")
public class MajorServiceImpl implements MajorService {

	@Resource
	private MajorMapper majorMapper;

	@Override
	public Optional<Major> findByName(String majorName) {
		Major major=majorMapper.findByName(majorName);
		return Optional.ofNullable(major);
	}

	@Override
	public List<Major> findAll() {
		List<Major> majorList=majorMapper.findAll();
		return  ListUtils.emptyIfNull(majorList);
	}


}
